<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>请假单</title>
<script type="text/javascript">
	$(function() {
		//把当前用户名发送给servlet
		$.ajax({
			type:"POST",
			url:"${pageContext.request.contextPath}/servlet/approveservlet",
			date:"name=${user.name }",
			success: function(jsonString,statustext,xhr){
				//把json格式字符串转换成json对象
				var jsonObject=eval(''+jsonString+'');
				var select$=$("#myselect");
				 select$.get(0).length=1;
				 for(var index=0; index<jsonObject.length;index++){
		        	  var option$=$('<option></option>');
		        	  option$.val(jsonObject[index].name);
		        	  option$.html(jsonObject[index].name);
		        	  select$.append(option$);
		          }
			},
			error:function(xhr,textstatus, errorthrown){
		       	console.log('请重新执行一次');
		       }
		})
	})
</script>
</head>
<body>
<h3>添加请假单基本信息</h3>
<fieldset style="width=40%">
	<legend>请假单基本信息</legend>
	<label for="username">请假者：</label>
	<input type="text" id="username" readonly="readonly" value="${user.name }"><br>
	<label for="content">请假事项：</label>
	<input type="text" id="content"><br>
	<label for="begintime">开始时间：</label>
	<input type="date" id="begintime"><br>
	<label for="endtime">结束时间：</label>
	<input type="date" id="endtime"><br>
	<label for="datenumber">请假天数：</label>
	<input type="text" id="datenumber"><br>
	<label for="approve">审批者：</label>
	<select id="myselect">
		<option value="0">-------请选择--------</option>
		<option value="2">财务部经理</option>
		<option value="2">业务部经理</option>
		<option value="3">行政部经理</option>
		<option value="4">设计部经理</option>
	</select><br>
	<input type="submit" value="提交请假单">
	<input type="reset" value="清空">
</fieldset>
<form action="${pageContext.request.contextPath }/servlet/addfillservlet" method="post">
	<input type="date" name="begin"><br>
	<input type="date" name="end"><br>
	<input type="submit" value="提交请假单">
	<input type="reset" value="清空">
</form>
</body>
</html>